/**********************************************************************
  main_analysis.do 
  Authors: Adam Panish*, Trent Ollerenshaw, and Joseph Vitriol 
  Note: Put this do-file in the same folder as pooled_data.xlsx

**********************************************************************/

***** Session Setup *****
clear all

* Import Dataset (make sure it's in the same folder as the do file!)
import excel "pooled_data.xlsx", sheet("Sheet1") firstrow clear

set seed 1996 // for reproducibility

* Standardize Some Variables
local vars dv_concern dv_behavior dv_restrictions auth_scale latentnsc1 latentnsc2 polengage_scale polint_scale polknow_scale
foreach var of local vars {
    egen mean_`var' = mean(`var')
    egen sd_`var' = sd(`var')
    generate z_`var' = (`var' - mean_`var') / sd_`var'
}

***** Table 1 Descriptive Statistics *****

* Sample Sizes (useable observations only)
tab sample if (auth_scale != . | latentnsc2 != .) & polengage_scale != . & (dv_concern != . | dv_restrictions != . | dv_behavior != .)

* Alphas
alpha auth1-auth4 if sample == "ANESGSS"
alpha auth1-auth5 if sample == "Lucid2020"
alpha auth1-auth8 if sample == "Lucid2021"
alpha auth1-auth4 if sample == "VSG"
alpha auth1-auth4 if sample == "MTurk"
alpha auth1-auth4 if sample == "Bovitz"

alpha polint1-polint2 if sample == "Lucid2020"
alpha polint1-polint2 if sample == "Lucid2021"
alpha polint1-polint6 if sample == "VSG"
alpha polint1-polint3 if sample == "MTurk"
alpha polint1-polint3 if sample == "Bovitz"

alpha polknow4-polknow8 if sample == "ANESGSS" // note: the first three knowledge items are pre-election, so missing
alpha polknow1-polknow6 if sample == "Lucid2020"
alpha polknow1-polknow5 if sample == "Lucid2021"
alpha polknow1-polknow7 if sample == "VSG"
alpha polknow1-polknow8 if sample == "MTurk"
alpha polknow1-polknow8 if sample == "Bovitz"

alpha dv_masking dv_distancing if sample == "Lucid2020"
alpha dv_masking dv_distancing dv_vaxstatus if sample == "Lucid2021"
alpha dv_masking dv_distancing dv_travel-dv_sanitize if sample == "MTurk"
alpha dv_masking dv_distancing dv_travel-dv_sanitize if sample == "Bovitz"

alpha dv_businesses dv_tracking dv_lockdowns dv_maskmandates if sample == "Lucid2020"
alpha dv_businesses dv_tracking dv_lockdowns dv_maskmandates dv_vaxmandate if sample == "Lucid2021"
alpha dv_businesses dv_staterestrict-dv_testingreq if sample == "VSG"

* 5th to 95th Percentiles of Authoritarianism and Latent NSC
sum auth_scale, det // 0 to 1
sum latentnsc2, det // 0.055 to 0.782

***** SM1 - Key Variable Histograms *****
histogram auth_scale, percent bin(4) by(sample, note("") col(3)) title("")
histogram latentnsc2, percent bin(6) by(sample, note("") col(3)) title("") 
histogram polengage_scale, percent bin(6) by(sample, note("") col(3)) title("") 
histogram dv_concern, percent bin(3) by(sample, note("") col(3)) title("") 
histogram dv_restrictions, percent bin(4) by(sample, note("") col(3)) title("") 
histogram dv_behavior, percent bin(3) by(sample, note("") col(3)) title("") 


***** Main Text Analyses & SM3 Regression Tables *****

* Set Up Multiple Imputation
mi set mlong
mi register imputed age education income male race sample_num
mi impute chained (logit) male (mlogit) race sample_num (regress) age education income, add(25) 

* COVID-19 Concern, Authoritarianism 
mi estimate: regress dv_concern c.auth_scale##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num state_1-state_51
quietly mimrgns, at(auth_scale=(0 1) polengage_scale=(0 .25 .5 .75 1)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
* COVID-19 Concern, Latent NSC 
mi estimate: regress dv_concern c.latentnsc2##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num
quietly mimrgns, at(latentnsc2=( 0.055  0.782) polengage_scale=(0 .25 .5 .75 1)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
* COVID-19 Restrictions, Authoritarianism 
mi estimate: regress dv_restrictions c.auth_scale##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num state_1-state_51
quietly mimrgns, at(auth_scale=(0 1) polengage_scale=(0 .25 .5 .75 1)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
* COVID-19 Behaviors, Authoritarianism 
mi estimate: regress dv_behavior c.auth_scale##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num state_1-state_51
quietly mimrgns, at(auth_scale=(0 1) polengage_scale=(0 .25 .5 .75 1)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
* COVID-19 Behaviors, Latent NSC 
mi estimate: regress dv_behavior c.latentnsc2##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num 
quietly mimrgns, at(latentnsc2=( 0.055  0.782) polengage_scale=(0 .25 .5 .75 1)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]

* Standardized Models for d 
mi estimate: regress z_dv_concern c.z_auth_scale##c.z_polengage_scale c.age##c.z_polengage_scale i.male##c.z_polengage_scale i.race##c.z_polengage_scale c.education##c.z_polengage_scale c.income##c.z_polengage_scale i.sample_num  state_1-state_51
mi estimate: regress z_dv_concern c.z_latentnsc2##c.z_polengage_scale c.age##c.z_polengage_scale i.male##c.z_polengage_scale i.race##c.z_polengage_scale c.education##c.z_polengage_scale c.income##c.z_polengage_scale i.sample_num 
mi estimate: regress z_dv_restrictions c.z_auth_scale##c.z_polengage_scale c.age##c.z_polengage_scale i.male##c.z_polengage_scale i.race##c.z_polengage_scale c.education##c.z_polengage_scale c.income##c.z_polengage_scale i.sample_num  state_1-state_51
mi estimate: regress z_dv_behavior c.z_auth_scale##c.z_polengage_scale c.age##c.z_polengage_scale i.male##c.z_polengage_scale i.race##c.z_polengage_scale c.education##c.z_polengage_scale c.income##c.z_polengage_scale i.sample_num  state_1-state_51
mi estimate: regress z_dv_behavior c.z_latentnsc2##c.z_polengage_scale c.age##c.z_polengage_scale i.male##c.z_polengage_scale i.race##c.z_polengage_scale c.education##c.z_polengage_scale c.income##c.z_polengage_scale i.sample_num 


***** Figure 3 - Individual Health Behaviors *****
*Note that the firthlogits take forever when combined with 25 MIs, quickest way to reproduce 99% similar results is to redo the MI with just 5 imputations. 

local vars dv_distancing dv_masking
foreach var of local vars {
mi estimate: regress `var' c.auth_scale##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num state_1-state_51
quietly mimrgns, at(auth_scale=(0 1) polengage_scale=(0 .25 .5 .75 1)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}

replace dv_vaxstatus = 1 if dv_vaxstatus == .5
mi estimate, cmdok: firthlogit dv_vaxstatus c.auth_scale##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale
quietly mimrgns, at(auth_scale=(0 1) polengage_scale=(0 .25 .5 .75 1) race=1) atmeans post expression(exp(predict(xb))/(1+exp(predict(xb))))
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at] 

local vars dv_travel dv_work_home dv_wash_hands dv_avoid_dine dv_cancel_event dv_sanitize 
foreach var of local vars {
mi estimate, cmdok: firthlogit `var' c.auth_scale##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num 
quietly mimrgns, at(auth_scale=(0 1) polengage_scale=(0 .25 .5 .75 1) race=1 sample_num=2) atmeans post expression(exp(predict(xb))/(1+exp(predict(xb))))
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}

local vars dv_distancing dv_masking
foreach var of local vars {
mi estimate: regress `var' c.latentnsc2##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num 
quietly mimrgns, at(latentnsc2=( 0.055  0.782) polengage_scale=(0 .25 .5 .75 1)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}

local vars dv_travel dv_work_home dv_wash_hands dv_avoid_dine dv_cancel_event dv_sanitize 
foreach var of local vars {
mi estimate, cmdok: firthlogit `var' c.latentnsc2##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num 
quietly mimrgns, at(latentnsc2=( 0.055  0.782) polengage_scale=(0 .25 .5 .75 1) race=1 sample_num=2) atmeans post expression(exp(predict(xb))/(1+exp(predict(xb))))
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
}



***** SM2 - Latent NSC with/without Covariances Modeled *****

* Reverse-Coded Covariances Modeled
mi estimate: regress z_dv_concern c.z_latentnsc2##c.z_polengage_scale c.age##c.z_polengage_scale i.male##c.z_polengage_scale i.race##c.z_polengage_scale c.education##c.z_polengage_scale c.income##c.z_polengage_scale i.sample_num
mi estimate: regress z_dv_behavior c.z_latentnsc2##c.z_polengage_scale c.age##c.z_polengage_scale i.male##c.z_polengage_scale i.race##c.z_polengage_scale c.education##c.z_polengage_scale c.income##c.z_polengage_scale i.sample_num 

* Reverse-Coded Covariances Not Modeled
mi estimate: regress z_dv_concern c.z_latentnsc1##c.z_polengage_scale c.age##c.z_polengage_scale i.male##c.z_polengage_scale i.race##c.z_polengage_scale c.education##c.z_polengage_scale c.income##c.z_polengage_scale i.sample_num
mi estimate: regress z_dv_behavior c.z_latentnsc1##c.z_polengage_scale c.age##c.z_polengage_scale i.male##c.z_polengage_scale i.race##c.z_polengage_scale c.education##c.z_polengage_scale c.income##c.z_polengage_scale i.sample_num 


***** SM3 - Conditional Sorting Models *****
alpha pid ideo, gen(leftright)

mi estimate: regress pid c.auth_scale##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num state_1-state_51
quietly mimrgns, at(auth_scale=(0 1) polengage_scale=(0 .25 .5 .75 1)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
mi estimate: regress ideo c.auth_scale##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num state_1-state_51
quietly mimrgns, at(auth_scale=(0 1) polengage_scale=(0 .25 .5 .75 1)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
mi estimate: regress leftright c.auth_scale##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num state_1-state_51
quietly mimrgns, at(auth_scale=(0 1) polengage_scale=(0 .25 .5 .75 1)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
mi estimate: regress pid c.latentnsc2##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num 
quietly mimrgns, at(latentnsc2=( 0.055  0.782) polengage_scale=(0 .25 .5 .75 1)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
mi estimate: regress ideo c.latentnsc2##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num 
quietly mimrgns, at(latentnsc2=( 0.055  0.782) polengage_scale=(0 .25 .5 .75 1)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]
mi estimate: regress leftright c.latentnsc2##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num
quietly mimrgns, at(latentnsc2=( 0.055  0.782) polengage_scale=(0 .25 .5 .75 1)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[7._at]-_b[2._at]
    lincom _b[8._at]-_b[3._at]
    lincom _b[9._at]-_b[4._at]
    lincom _b[10._at]-_b[5._at]


***** SM4 - ALTERNATIVE MODEL SPECIFICATIONS *****

*Concern, Authoritarianism 
mi estimate: regress dv_concern c.auth_scale i.sample_num
mi estimate: regress dv_concern c.auth_scale c.age i.male i.race c.education c.income i.sample_num state_1-state_51 polengage_scale
mi estimate: regress dv_concern c.auth_scale##c.polengage_scale i.sample_num 
mi estimate: regress dv_concern c.auth_scale##c.polengage_scale c.age i.male i.race c.education c.income i.sample_num state_1-state_51
mi estimate: regress dv_concern c.auth_scale##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num state_1-state_51

*Behaviors, Authoritarianism 
mi estimate: regress dv_behavior c.auth_scale i.sample_num 
mi estimate: regress dv_behavior c.auth_scale c.age i.male i.race c.education c.income i.sample_num state_1-state_51 polengage_scale
mi estimate: regress dv_behavior c.auth_scale##c.polengage_scale i.sample_num 
mi estimate: regress dv_behavior c.auth_scale##c.polengage_scale c.age i.male i.race c.education c.income i.sample_num state_1-state_51
mi estimate: regress dv_behavior c.auth_scale##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num state_1-state_51

*Restrictions, Authoritarianism 
mi estimate: regress dv_restrictions c.auth_scale i.sample_num 
mi estimate: regress dv_restrictions c.auth_scale c.age i.male i.race c.education c.income i.sample_num state_1-state_51 polengage_scale
mi estimate: regress dv_restrictions c.auth_scale##c.polengage_scale i.sample_num 
mi estimate: regress dv_restrictions c.auth_scale##c.polengage_scale c.age i.male i.race c.education c.income i.sample_num state_1-state_51
mi estimate: regress dv_restrictions c.auth_scale##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num state_1-state_51

*Concern, Latent NSC 
mi estimate: regress dv_concern c.latentnsc2 i.sample_num 
mi estimate: regress dv_concern c.latentnsc2 c.age i.male i.race c.education c.income i.sample_num polengage_scale
mi estimate: regress dv_concern c.latentnsc2##c.polengage_scale i.sample_num
mi estimate: regress dv_concern c.latentnsc2##c.polengage_scale c.age i.male i.race c.education c.income i.sample_num
mi estimate: regress dv_concern c.latentnsc2##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num

*Behaviors, Latent NSC 
mi estimate: regress dv_behavior c.latentnsc2 i.sample_num 
mi estimate: regress dv_behavior c.latentnsc2 c.age i.male i.race c.education c.income i.sample_num polengage_scale
mi estimate: regress dv_behavior c.latentnsc2##c.polengage_scale i.sample_num
mi estimate: regress dv_behavior c.latentnsc2##c.polengage_scale c.age i.male i.race c.education c.income i.sample_num
mi estimate: regress dv_behavior c.latentnsc2##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num


***** SM5 - Binning Estimator *****

* Concern, Auth
sum polengage_scale if dv_concern != . & auth_scale != . & polengage_scale < 0.33, det
sum polengage_scale if dv_concern != . & auth_scale != . & polengage_scale >= 0.33 & polengage_scale < 0.67, det
sum polengage_scale if dv_concern != . & auth_scale != . & polengage_scale >= 0.67, det // Bin Medians: 0.20, 0.56, 0.93
mi estimate: regress dv_concern c.auth_scale c.age i.male i.race c.education c.income i.sample_num polengage_scale if polengage_scale < 0.33
mi estimate: regress dv_concern c.auth_scale c.age i.male i.race c.education c.income i.sample_num polengage_scale if polengage_scale >= 0.33 & polengage_scale < 0.67
mi estimate: regress dv_concern c.auth_scale c.age i.male i.race c.education c.income i.sample_num polengage_scale if polengage_scale >= 0.67

* Concern, NSC
sum polengage_scale if dv_concern != . & latentnsc2 != . & polengage_scale < 0.50, det
sum polengage_scale if dv_concern != . & latentnsc2 != . & polengage_scale >= 0.50, det // Bin Medians: 0.41, 0.81
mi estimate: regress dv_concern c.latentnsc2 c.age i.male i.race c.education c.income i.sample_num polengage_scale if polengage_scale < 0.50
quietly mimrgns, at(latentnsc2=( 0.055  0.782)) coeflegend post
lincom _b[2._at]-_b[1._at]
mi estimate: regress dv_concern c.latentnsc2 c.age i.male i.race c.education c.income i.sample_num polengage_scale if polengage_scale >= 0.50
quietly mimrgns, at(latentnsc2=( 0.055  0.782)) coeflegend post
lincom _b[2._at]-_b[1._at]

* Restrictions, Auth Medians: 0.20, 0.52, 0.93
sum polengage_scale if dv_restrictions != . & auth_scale != . & polengage_scale < 0.33, det
sum polengage_scale if dv_restrictions != . & auth_scale != . & polengage_scale >= 0.33 & polengage_scale < 0.67, det
sum polengage_scale if dv_restrictions != . & auth_scale != . & polengage_scale >= 0.67, det

mi estimate: regress dv_restrictions c.auth_scale c.age i.male i.race c.education c.income i.sample_num polengage_scale if polengage_scale < 0.33
mi estimate: regress dv_restrictions c.auth_scale c.age i.male i.race c.education c.income i.sample_num polengage_scale if polengage_scale >= 0.33 & polengage_scale < 0.67
mi estimate: regress dv_restrictions c.auth_scale c.age i.male i.race c.education c.income i.sample_num polengage_scale if polengage_scale >= 0.67

* Behavior, Auth Medians: 0.22, 0.50, 0.84
sum polengage_scale if dv_behavior != . & auth_scale != . & polengage_scale < 0.33, det
sum polengage_scale if dv_behavior != . & auth_scale != . & polengage_scale >= 0.33 & polengage_scale < 0.67, det
sum polengage_scale if dv_behavior != . & auth_scale != . & polengage_scale >= 0.67, det

mi estimate: regress dv_behavior c.auth_scale c.age i.male i.race c.education c.income i.sample_num polengage_scale if polengage_scale < 0.33
mi estimate: regress dv_behavior c.auth_scale c.age i.male i.race c.education c.income i.sample_num polengage_scale if polengage_scale >= 0.33 & polengage_scale < 0.67
mi estimate: regress dv_behavior c.auth_scale c.age i.male i.race c.education c.income i.sample_num polengage_scale if polengage_scale >= 0.67

* Behavior, NSC Medians: 0.41, 0.81
sum polengage_scale if dv_concern != . & latentnsc2 != . & polengage_scale < 0.50, det
sum polengage_scale if dv_concern != . & latentnsc2 != . & polengage_scale >= 0.50, det

mi estimate: regress dv_behavior c.latentnsc2 c.age i.male i.race c.education c.income i.sample_num polengage_scale if polengage_scale < 0.50
quietly mimrgns, at(latentnsc2=( 0.055  0.782)) coeflegend post
lincom _b[2._at]-_b[1._at]
mi estimate: regress dv_behavior c.latentnsc2 c.age i.male i.race c.education c.income i.sample_num polengage_scale if polengage_scale >= 0.50
quietly mimrgns, at(latentnsc2=( 0.055  0.782)) coeflegend post
lincom _b[2._at]-_b[1._at]

	
***** SM7 - Political Engagement vs. Interest vs. Knowledge *****

*Concern, Authoritarianism 
mi estimate: regress z_dv_concern c.z_auth_scale##c.z_polengage_scale c.age##c.z_polengage_scale i.male##c.z_polengage_scale i.race##c.z_polengage_scale c.education##c.z_polengage_scale c.income##c.z_polengage_scale i.sample_num state_1-state_51
mi estimate: regress z_dv_concern c.z_auth_scale##c.z_polint_scale c.age##c.z_polint_scale i.male##c.z_polint_scale i.race##c.z_polint_scale c.education##c.z_polint_scale c.income##c.z_polint_scale i.sample_num state_1-state_51
mi estimate: regress z_dv_concern c.z_auth_scale##c.z_polknow_scale c.age##c.z_polknow_scale i.male##c.z_polknow_scale i.race##c.z_polknow_scale c.education##c.z_polknow_scale c.income##c.z_polknow_scale i.sample_num state_1-state_51

*Concern, Latent NSC 2
mi estimate: regress z_dv_concern c.z_latentnsc2##c.z_polengage_scale c.age##c.z_polengage_scale i.male##c.z_polengage_scale i.race##c.z_polengage_scale c.education##c.z_polengage_scale c.income##c.z_polengage_scale i.sample_num 
mi estimate: regress z_dv_concern c.z_latentnsc2##c.z_polint_scale c.age##c.z_polint_scale i.male##c.z_polint_scale i.race##c.z_polint_scale c.education##c.z_polint_scale c.income##c.z_polint_scale i.sample_num 
mi estimate: regress z_dv_concern c.z_latentnsc2##c.z_polknow_scale c.age##c.z_polknow_scale i.male##c.z_polknow_scale i.race##c.z_polknow_scale c.education##c.z_polknow_scale c.income##c.z_polknow_scale i.sample_num 

*Restrictions, Authoritarianism 
mi estimate: regress z_dv_restrictions c.z_auth_scale##c.z_polengage_scale c.age##c.z_polengage_scale i.male##c.z_polengage_scale i.race##c.z_polengage_scale c.education##c.z_polengage_scale c.income##c.z_polengage_scale i.sample_num state_1-state_51
mi estimate: regress z_dv_restrictions c.z_auth_scale##c.z_polint_scale c.age##c.z_polint_scale i.male##c.z_polint_scale i.race##c.z_polint_scale c.education##c.z_polint_scale c.income##c.z_polint_scale i.sample_num state_1-state_51
mi estimate: regress z_dv_restrictions c.z_auth_scale##c.z_polknow_scale c.age##c.z_polknow_scale i.male##c.z_polknow_scale i.race##c.z_polknow_scale c.education##c.z_polknow_scale c.income##c.z_polknow_scale i.sample_num state_1-state_51

*Behaviors, Authoritarianism 
mi estimate: regress z_dv_behavior c.z_auth_scale##c.z_polengage_scale c.age##c.z_polengage_scale i.male##c.z_polengage_scale i.race##c.z_polengage_scale c.education##c.z_polengage_scale c.income##c.z_polengage_scale i.sample_num state_1-state_51
mi estimate: regress z_dv_behavior c.z_auth_scale##c.z_polint_scale c.age##c.z_polint_scale i.male##c.z_polint_scale i.race##c.z_polint_scale c.education##c.z_polint_scale c.income##c.z_polint_scale i.sample_num state_1-state_51
mi estimate: regress z_dv_behavior c.z_auth_scale##c.z_polknow_scale c.age##c.z_polknow_scale i.male##c.z_polknow_scale i.race##c.z_polknow_scale c.education##c.z_polknow_scale c.income##c.z_polknow_scale i.sample_num state_1-state_51

*Behaviors, Latent NSC 2
mi estimate: regress z_dv_behavior c.z_latentnsc2##c.z_polengage_scale c.age##c.z_polengage_scale i.male##c.z_polengage_scale i.race##c.z_polengage_scale c.education##c.z_polengage_scale c.income##c.z_polengage_scale i.sample_num 
mi estimate: regress z_dv_behavior c.z_latentnsc2##c.z_polint_scale c.age##c.z_polint_scale i.male##c.z_polint_scale i.race##c.z_polint_scale c.education##c.z_polint_scale c.income##c.z_polint_scale i.sample_num 
mi estimate: regress z_dv_behavior c.z_latentnsc2##c.z_polknow_scale c.age##c.z_polknow_scale i.male##c.z_polknow_scale i.race##c.z_polknow_scale c.education##c.z_polknow_scale c.income##c.z_polknow_scale i.sample_num 


***** SM8 - Within-Sample Attitude-Behavior Comparisons *****
mi estimate: regress z_dv_concern c.z_auth_scale##c.z_polengage_scale c.age##c.z_polengage_scale i.male##c.z_polengage_scale i.race##c.z_polengage_scale c.education##c.z_polengage_scale c.income##c.z_polengage_scale i.sample_num if (sample == "MTurk" | sample == "Bovitz") & z_dv_behavior != .
mi estimate: regress z_dv_behavior c.z_auth_scale##c.z_polengage_scale c.age##c.z_polengage_scale i.male##c.z_polengage_scale i.race##c.z_polengage_scale c.education##c.z_polengage_scale c.income##c.z_polengage_scale i.sample_num if (sample == "MTurk" | sample == "Bovitz") & z_dv_concern != .

mi estimate: regress z_dv_concern c.z_latentnsc2##c.z_polengage_scale c.age##c.z_polengage_scale i.male##c.z_polengage_scale i.race##c.z_polengage_scale c.education##c.z_polengage_scale c.income##c.z_polengage_scale i.sample_num if (sample == "MTurk" | sample == "Bovitz") & z_dv_behavior != .
mi estimate: regress z_dv_behavior c.z_latentnsc2##c.z_polengage_scale c.age##c.z_polengage_scale i.male##c.z_polengage_scale i.race##c.z_polengage_scale c.education##c.z_polengage_scale c.income##c.z_polengage_scale i.sample_num if (sample == "MTurk" | sample == "Bovitz") & z_dv_concern != .

mi estimate: regress z_dv_restrictions c.z_auth_scale##c.z_polengage_scale c.age##c.z_polengage_scale i.male##c.z_polengage_scale i.race##c.z_polengage_scale c.education##c.z_polengage_scale c.income##c.z_polengage_scale i.sample_num if (sample == "Lucid2020" | sample == "Lucid2021") & z_dv_behavior != .
mi estimate: regress z_dv_behavior c.z_auth_scale##c.z_polengage_scale c.age##c.z_polengage_scale i.male##c.z_polengage_scale i.race##c.z_polengage_scale c.education##c.z_polengage_scale c.income##c.z_polengage_scale i.sample_num if (sample == "Lucid2020" | sample == "Lucid2021") & z_dv_restrictions != .


***** SM3 - Controls for PID/IDEO for Mediation Test *****
import excel "pooled_data.xlsx", sheet("Sheet1") firstrow clear // run this separately since the MI is different
mi set mlong
mi register imputed age education income male race sample_num pid ideo // add pid and ideo so no extra listwise deletion from pid or ideo (i.e., models being compared use fixed observations)
mi impute chained (logit) male (mlogit) race sample_num (regress) age education income pid ideo, add(25) 

*Concern, Authoritarianism 
quietly mi estimate: regress dv_concern c.auth_scale##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num state_1-state_51 pid ideo
quietly mimrgns, at(auth_scale=(0 1) polengage_scale=(0 .25 .5 .75 1)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[10._at]-_b[5._at]
*Restrictions, Authoritarianism 
quietly mi estimate: regress dv_restrictions c.auth_scale##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num state_1-state_51 pid ideo
quietly mimrgns, at(auth_scale=(0 1) polengage_scale=(0 .25 .5 .75 1)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[10._at]-_b[5._at]
*Behavior, Authoritarianism 
quietly mi estimate: regress dv_behavior c.auth_scale##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num state_1-state_51 pid ideo
quietly mimrgns, at(auth_scale=(0 1) polengage_scale=(0 .25 .5 .75 1)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[10._at]-_b[5._at]
*Concern, Latent NSC 
quietly mi estimate: regress dv_concern c.latentnsc2##c.polengage_scale c.age##c.polengage_scale i.male##c.polengage_scale i.race##c.polengage_scale c.education##c.polengage_scale c.income##c.polengage_scale i.sample_num pid ideo
quietly mimrgns, at(latentnsc2=( 0.055  0.782) polengage_scale=(0 .25 .5 .75 1)) coeflegend post
    lincom _b[6._at]-_b[1._at]
    lincom _b[10._at]-_b[5._at]
	
clear // run this separately since the MI is different

